## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.6     ✓ dplyr   1.0.8
## ✓ tidyr   1.2.0     ✓ stringr 1.4.0
## ✓ readr   2.1.2     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()

1. Overall Location

a) Provide a map to show where in New York City AirBnB listings are located.

## 
## Attaching package: 'maps'
## The following object is masked from 'package:purrr':
## 
##     map
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
## Replacing old key (AIzaSyAcu74WHxUwJta9TPoTRh10) with new key in /Users/yanlinzhang/.Renviron
## Source : https://maps.googleapis.com/maps/api/staticmap?center=New%20York%20City&zoom=10&size=640x640&scale=2&maptype=terrain&key=xxx-u2_oBNnHOs
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=New+York+City&key=xxx-u2_oBNnHOs
## Source : http://tile.stamen.com/toner-background/10/300/383.png
## Source : http://tile.stamen.com/toner-background/10/301/383.png
## Source : http://tile.stamen.com/toner-background/10/302/383.png
## Source : http://tile.stamen.com/toner-background/10/300/384.png
## Source : http://tile.stamen.com/toner-background/10/301/384.png
## Source : http://tile.stamen.com/toner-background/10/302/384.png
## Source : http://tile.stamen.com/toner-background/10/300/385.png
## Source : http://tile.stamen.com/toner-background/10/301/385.png
## Source : http://tile.stamen.com/toner-background/10/302/385.png
## Source : http://tile.stamen.com/toner-background/10/300/386.png
## Source : http://tile.stamen.com/toner-background/10/301/386.png
## Source : http://tile.stamen.com/toner-background/10/302/386.png

This is a static map showing a very general distribution of all AirBnB listings within the area of NYC. I set the ZOOM to be 10 since any bit of zoom-in will not capture the whole NYC, and it’s not applicable to add any digits. The general pattern is that the northern Brooklyn, roughly the whole Manhattan island, and northeastern Queens have lots of rentals available, whereas apartments in other districts are sort of more sparsely allocated. Certain areas like Staten Island has a lot fewer apartments open for rental.

b) Provide a map in which you summarize the density of the AirBnB listings and highlight the hot-spots for AirBnB locations. Make sure to annotate a few hot-spots on the map.

## Source : https://maps.googleapis.com/maps/api/staticmap?center=New%20York%20City&zoom=12&size=640x640&scale=2&maptype=terrain&key=xxx-u2_oBNnHOs
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=New+York+City&key=xxx-u2_oBNnHOs
## Source : http://tile.stamen.com/toner-background/12/1204/1538.png
## Source : http://tile.stamen.com/toner-background/12/1205/1538.png
## Source : http://tile.stamen.com/toner-background/12/1206/1538.png
## Source : http://tile.stamen.com/toner-background/12/1207/1538.png
## Source : http://tile.stamen.com/toner-background/12/1204/1539.png
## Source : http://tile.stamen.com/toner-background/12/1205/1539.png
## Source : http://tile.stamen.com/toner-background/12/1206/1539.png
## Source : http://tile.stamen.com/toner-background/12/1207/1539.png
## Source : http://tile.stamen.com/toner-background/12/1204/1540.png
## Source : http://tile.stamen.com/toner-background/12/1205/1540.png
## Source : http://tile.stamen.com/toner-background/12/1206/1540.png
## Source : http://tile.stamen.com/toner-background/12/1207/1540.png
## Source : http://tile.stamen.com/toner-background/12/1204/1541.png
## Source : http://tile.stamen.com/toner-background/12/1205/1541.png
## Source : http://tile.stamen.com/toner-background/12/1206/1541.png
## Source : http://tile.stamen.com/toner-background/12/1207/1541.png
## Warning: Removed 10503 rows containing non-finite values (stat_density2d).

Above is a chloropleth showing the density of AirBnB listings across NYC. The most remarkable hotspots are around Hell’s Kitchen and Lower East Side of Manhattan, where both spots have the most dense AirBnB places available, around the level of 250. Other areas like Greenwich Village of Manhattan and Williamsburg also have conspicuously more listings, up to the level of 150 and 200 respectively.

2. Renting out your apartment vs. permanent rentals

a) Choose a combination of both maps and non-mapping visualizations (graphs or tables) to explore where in NYC listings are available sporadically vs. year-round. Make sure to highlight the neighborhoods were most listings appear to be permanent or semi-permanent rentals.

This is a general graph showing the distributions of both the year-round and sporadic listings. We can see the rough trend that year-round apartments are centered at midtown and downtown Manhattan, upper Brooklyn and eastern part of Queens.

## Linking to GEOS 3.9.1, GDAL 3.4.0, PROJ 8.1.1; sf_use_s2() is TRUE
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

This graph shows specific neighborhoods with highly densely permanent/semi-permanent listings, which is mostly centered around Hell’s kitchen, Theater District, and Midtown neighborhoods, which collectively form a hotspot of 200-level-dense listings. There are also one less “hot” hotspot in Brooklyn, which is consists of Bushwick and Bedford-Stuyvesant neighborhoods.

For sporadic listings, the hotspot is the Lower East Side, including neighborhoods like East Village, SoHo, Noho, etc.

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

The histogram shows the days availability in a year for all apartments, grouped by sporadic and year-round rental time. It tells us very roughly that a lot more apartments are rent sporadically (defined to be less than 300 days in a year). The bar plot further compares two types of rental time of apartments across different boroughs, as well as the fact that Brooklyn and Manhattan as a whole have more AirBnB listings than other boroughs.

Above are two bar plots comparing the top 5 neighborhoods for sporadic and year-round rentals separately. Apparently there are a lot more sporadicatlly rent apartments than perminant ones, distributed across Bushwick, Bedford-Stuyvesant, and so on. Top 5 for sporadic rentals include Harlem, Bedford-Stuyvesant, Hell’s Kitchen, etc.

b) Some hosts (identified by host_id) operate multiple rentals. Provide a data table of the the top hosts, the total number of listings they are associated with, the average nightly price, and the estimated average monthly total income from these listings.

## Warning: NAs introduced by coercion
## Warning in instance$preRenderHook(instance): It seems your data is too big
## for client-side DataTables. You may consider server-side processing: https://
## rstudio.github.io/DT/server.html

Above is an interactive data table showing top hosts sorted from most to least number of listings and their corresponding average nightly price and estimated average monthly total income. The colors embedded in the cells help readers to visualize the price and income more clearly, and perhaps help illustrate how the listings are not necessarily linearly relevant.

3. Top Reviewed Rentals

Provide an interactive map which shows the Top 100 most expensive and Top 100 best reviewed rentals in NYC. The map should differentiate these two groups and upon clicking on a point on the map should show some basic information (at least 3 pieces of information) in a tool tip.

## Loading required package: usethis
## Downloading GitHub repo rstudio/leaflet@HEAD
## 
## * checking for file ‘/private/var/folders/lp/v4x5vmys7d5506998ljns1j40000gn/T/Rtmpo3Zam2/remotes1833d399f5e91/rstudio-leaflet-00e053b/DESCRIPTION’ ... OK
## * preparing ‘leaflet’:
## * checking DESCRIPTION meta-information ... OK
## * checking for LF line-endings in source and make files and shell scripts
## * checking for empty or unneeded directories
## Removed empty directory ‘leaflet/docs’
## Removed empty directory ‘leaflet/man-roxygen’
## * building ‘leaflet_2.1.0.9000.tar.gz’

This is an interactive map showing the distributions of both Top 100 best reviewed and expensive listings. We can see that the expensive apartments are more clustered in the Manhattan area, whereas the best reviewed ones are distributed more sparsely, some in upper Brooklyn, Bronx, and eastern Queens (LIC for example).